document.addEventListener('DOMContentLoaded', function () {
    // 侧边栏菜单项 tooltip 初始化
    const navItems = document.querySelectorAll('#mainSidebar .nav-item');

    navItems.forEach(item => {
        const link = item.querySelector('.nav-link');
        const title = link.querySelector('.sidebar-text').textContent;

        // 初始化 tooltip
        new bootstrap.Tooltip(link, {
            title: title,
            placement: 'right',
            trigger: 'hover',
            customClass: 'custom-tooltip',
            animation: false,
            delay: { show: 300, hide: 100 }
        });

        // 添加鼠标悬停效果
        link.addEventListener('mouseenter', function () {
            this.classList.add('hover-active');
        });

        link.addEventListener('mouseleave', function () {
            this.classList.remove('hover-active');
        });
    });

    // 保持原有的侧边栏折叠功能
    const toggleBtn = document.getElementById('toggleSidebar');
    const sidebar = document.getElementById('mainSidebar');
});